{extend name="layout" /}

{block name="page-header"}{/block}

{block name="content"}
<style>
    * {
        margin: 0;
        padding: 0;
    }

    #chart-container {
        position: relative;
        height: 100vh;
        overflow: hidden;
    }
</style>

<div class="row">
    <div class="col-md-12">
        <div class="block">

            <div class="block-content tab-content">

                <div id="chart-container"></div>
                <script
                    src="__LIBS__/echarts/echarts.min.js"></script>

            </div>
        </div>

    </div>
</div>

<script src="__LIBS__/laydate/laydate.js"></script>
<script>
    var dom = document.getElementById('chart-container');
    var myChart = echarts.init(dom, null, {
        renderer: 'canvas',
        useDirtyRect: false
    });
    var app = {};

    var option;

    option = {
        title: {
            text: '用户在线情况[总用户{$all_user}人]',
            subtext: 'Data',
            left: 'center'
        },
        tooltip: {
            trigger: 'item'
        },
        legend: {
            orient: 'vertical',
            left: 'left'
        },
        series: [{
            name: '',
            type: 'pie',
            radius: '50%',
            data: [{
                    value: {$over24},
                    name: '二十四以前在线的用户 {$over24}'
                },
                {
                    value: {$hour24},
                    name: '二十四小时在线的用户 {$hour24}'
                },
                {
                    value: {$today},
                    name: '今天在线的用户 {$today}'
                },
                {
                    value: {$hour1},
                    name: '一小时在线的用户 {$hour1}'
                },
            ],
            emphasis: {
                itemStyle: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }]
    };


    if (option && typeof option === 'object') {
        myChart.setOption(option);
    }

    window.addEventListener('resize', myChart.resize);


    var day = new Date();
    day.setTime(day.getTime());
    var time = day.getFullYear() + "-" + (day.getMonth() + 1) + "-" + day.getDate();
    //执行一个laydate实例
    laydate.render({
        elem: '#query_begin_time', //指定元素
        type: 'datetime'
    });
    laydate.render({
        elem: '#query_end_time', //指定元素
        type: 'datetime'
    })
</script>

{/block}

{block name="script"}

{/block}